using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
using TitanX;
/// <summary>
/// 通用弹窗类
/// </summary>

public enum PopType{top,tip};

public class PopManger : SingletonGetMono<PopManger>
{


    //第二种弹窗，玩家头上稍为显示
        public PopType popType;


        public GameObject[] tips;

        public Text contentText;
        public float offset;
        public float waitTime;
        public float moveTime;


        public bool isRun;
  



        private void Awake(){
            contentText=transform.Find("Text").GetComponent<Text>();
        }



    private void Start()
    {
        //pop("测试内容");
    }

    public void pop(string content){
            contentText.text=content;
            //等到几秒，再回去

          Tweener tweener =  transform.DOLocalMoveY(offset,moveTime);

           Tweener tweener2 =  transform.DOScale(1, waitTime);
          
          Sequence mySequence = DOTween.Sequence();//创建空序列
            
          mySequence.Append(tweener);
          mySequence.Append(tweener2);
          mySequence.SetLoops(2,LoopType.Yoyo);//对序列进行设置
        mySequence.Play();


    }





        public void showTip(){
            GameObject gm=availableTipObject();
            gm.SetActive(false);
            //播放完动画，触发事件呢
            //取出 可用的top，删除
            //播放完成，自动销毁对象



        }




        public GameObject availableTipObject(){

            foreach(GameObject gm in tips){

                if(!gm.active){

                    return gm;
                }
            }

        return null;

        }


    /// <summary>
    /// 显示VS效果
    /// </summary>
    public void VSshow() { 
    
           
    
    
    }


}